package test

import (
	"fmt"
	"net/url"

	"databasex/dbx"

	. "github.com/onsi/ginkgo/v2"
	. "github.com/onsi/gomega"
)

var _ = DescribeTable("clickhouse",
	func(set dbx.ClickHouse) {
		fmt.Println(set.DSN(nil))

		Expect(set.DSN(url.Values{})).To(Equal("clickhouse://UserName:Password@192.168.11.5:9000,192.168.11.6:9000/DataBase?dial_timeout=200ms&read_timeout=20s"))
	},
	Entry("addr", dbx.ClickHouse{
		DataBase: dbx.ClickHouseSet{
			DataBase: "DataBase",
			UserName: "UserName",
			Password: "Password",
			Addrs:    []string{"192.168.11.5:9000", "192.168.11.6:9000"},
		},
		TLS: dbx.TLS{},
	}),
)
